package com.app.shortvideo.ui.viewmodel

import android.content.Context
import androidx.lifecycle.MutableLiveData
import androidx.room.Room
import androidx.room.RoomDatabase
import com.app.shortvideo.database.AppDatabase
import com.app.shortvideo.net.CommonService
import com.app.shortvideo.net.base.BuildAPI
import com.app.shortvideo.net.base.VersionInfo
import com.app.library.base.LibViewModel

open class BaseViewModel : LibViewModel() {
    private val mService = BuildAPI.buildAPISevers(CommonService::class.java)
    val updateResult = MutableLiveData<VersionInfo>()
    var appDb: AppDatabase? = null
    fun initDb(context: Context){
        if (appDb==null) {
            appDb = Room.databaseBuilder(context, AppDatabase::class.java, "mossDB.db")
                .allowMainThreadQueries()
                .build()
        }
    }
}